<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
    <h:head>
        <title>TODO supply a title</title>
        <meta name="viewport" content="width=device-width"/>
    </h:head>
    <h:body>

        <h:form id="formCreateUsers">  
            
            <h:panelGrid style="margin: 0 auto">
                <p:outputLabel value="CREAR USUARIOS" style="color: #2480BC;"/>
                <br></br>
                <br></br>
            </h:panelGrid>
            <p:tabView id="tabView" dynamic="true" >  

                <p:tab title="Informacion de Log In" id="login">  
                    <h:panelGrid columns="2" cellpadding="10" id="hpcua"> 
                        <h:outputText value = "Nombre de Usuario"/>
                        <p:inputText id="username" value="#{createUserBean.nameUser}" />

                        <h:outputText value = "Host:"/>
                        <p:inputText id="host" value="#{createUserBean.host}"  />

                        <h:outputText value = "Contraseña"/>
                        <p:password id = "password" value="#{createUserBean.password}" feedback="true"/>

                        <h:outputText value = "Ingrese su contraseña de nuevo"/>
                        <p:password  id="retypePassword" value="#{createUserBean.retypePassword}"/> 
                    </h:panelGrid>  
                </p:tab>  
                <p:tab title="Privilegios Globales" id="globalprivileges"> 
                    <h:panelGrid columns="3" style="margin: 0 auto; width: 1000px" >
                        <h:panelGrid columns="1" cellpadding="10" style="margin-left: -5px;" border="10">  
                            <h:outputText value="Data" style="color: #2480BC" />  
                            <p:selectManyCheckbox id="data" value="#{createUserBean.selectedDataOptions}"  
                                                  layout="pageDirection">  
                                <f:selectItem itemLabel="SELECT" itemValue="SELECT" />  
                                <f:selectItem itemLabel="INSERT" itemValue="INSERT" />  
                                <f:selectItem itemLabel="UPDATE" itemValue="UPDATE" />
                                <f:selectItem itemLabel="DELETE" itemValue="DELETE" />  
                                <f:selectItem itemLabel="FILE" itemValue="FILE" />  
                            </p:selectManyCheckbox>
                            <p:selectBooleanCheckbox value="#{createUserBean.checkData}" itemLabel="Seleccionar Todos" >
                                    <p:ajax  event="change" update="data" listener="#{createUserBean.changeCheckData}"/>
                                </p:selectBooleanCheckbox>
                        </h:panelGrid> 
                        <h:panelGrid columns="1" cellpadding="10" style="margin: 0 auto" border="10">  
                            <h:outputText value="Structure" style="color: #2480BC" />  
                            <p:selectManyCheckbox id="structure" value="#{createUserBean.selectedStructureOptions}"  
                                                  layout="pageDirection">  
                                <f:selectItem itemLabel="CREATE" itemValue="CREATE" />  
                                <f:selectItem itemLabel="ALTER" itemValue="ALTER" />  
                                <f:selectItem itemLabel="INDEX" itemValue="INDEX" />
                                <f:selectItem itemLabel="DROP" itemValue="DROP" />  
                                <f:selectItem itemLabel="CREATE TEMPORARY TABLES" itemValue="CREATE TEMPORARY TABLES" /> 
                                <f:selectItem itemLabel="SHOW VIEW" itemValue="SHOW VIEW" />  
                                <f:selectItem itemLabel="CREATE ROUTINE" itemValue="CREATE ROUTINE" />  
                                <f:selectItem itemLabel="ALTER ROUTINE" itemValue="ALTER ROUTINE" />
                                <f:selectItem itemLabel="EXECUTE" itemValue="EXECUTE" />  
                                <f:selectItem itemLabel="CREATE VIEW" itemValue="CREATE VIEW" /> 
                                <f:selectItem itemLabel="EVENT" itemValue="EVENT" />  
                                <f:selectItem itemLabel="TRIGGER" itemValue="TRIGGER" />
                            </p:selectManyCheckbox>
                            <p:selectBooleanCheckbox value="#{createUserBean.checkStructure}" itemLabel="Seleccionar Todos" >
                                <p:ajax  event="change" update="structure" listener="#{createUserBean.changeCheckStructure()}"/>
                                </p:selectBooleanCheckbox>
                        </h:panelGrid>
                        <h:panelGrid columns="1" cellpadding="10" style="margin-right: -5px" border="10" >  
                            <h:outputText value="Administration " style="color: #2480BC"/>  
                            <p:selectManyCheckbox id="administration" value="#{createUserBean.selectedAdministrationOptions}"  
                                                  layout="pageDirection">  
                                <f:selectItem itemLabel="GRANT OPTION" itemValue="GRANT OPTION" />  
                                <f:selectItem itemLabel="SUPER" itemValue="SUPER" />  
                                <f:selectItem itemLabel="PROCESS" itemValue="PROCESS" />
                                <f:selectItem itemLabel="RELOAD" itemValue="RELOAD" />  
                                <f:selectItem itemLabel="SHUTDOWN" itemValue="SHUTDOWN" /> 
                                <f:selectItem itemLabel="SHOW DATABASES" itemValue="SHOW DATABASES" />  
                                <f:selectItem itemLabel="LOCK TABLES" itemValue="LOCK TABLES" />  
                                <f:selectItem itemLabel="REFERENCES" itemValue="REFERENCES" />
                                <f:selectItem itemLabel="REPLICATION CLIENT" itemValue="REPLICATION CLIENT" />  
                                <f:selectItem itemLabel="REPLICATION SLAVE" itemValue="REPLICATION SLAVE" /> 
                                <f:selectItem itemLabel="CREATE USER" itemValue="CREATE USER" />  
                            </p:selectManyCheckbox>
                            <p:selectBooleanCheckbox value="#{createUserBean.checkAdmin}" itemLabel="Seleccionar Todos" >
                                <p:ajax  event="change" update="administration" listener="#{createUserBean.changeCheckAdmin}"/>
                                </p:selectBooleanCheckbox>
                        </h:panelGrid> 
                    </h:panelGrid>
                </p:tab>  
                <p:tab title="Limites de la Cuenta" id="accountLimits">  
                    <h:panelGrid columns="2" cellpadding="10" style="margin: 0 auto">  
                        <h:outputText value="MAX QUERIES PER HOUR"/>
                        <h:inputText value="#{createUserBean.maxQueriesPerHour}" style="width: 30px;"/>
                        <h:outputText value="MAX UPDATES PER HOUR"/>
                        <h:inputText value="#{createUserBean.maxUpdatesPerHour}" style="width: 30px;"/>
                        <h:outputText value="MAX CONNECTIONS PER HOUR"/>
                        <h:inputText value="#{createUserBean.maxConnectionsPerHour}" style="width: 30px;"/>
                        <h:outputText value="MAX USER_CONNECTIONS"/>
                        <h:inputText value="#{createUserBean.maxUserConnections}" style="width: 30px;"/>
                    </h:panelGrid>  
                </p:tab>     
            </p:tabView>  
            <h:panelGrid columns="1" >            
                <p:growl id="growl2" showDetail="true" autoUpdate="true" life="10000"/> 
                <p:commandButton value="Crear Usuario" action="#{createUserBean.createUser}"  >
                    <p:confirm header="Confirmation" message="Esta Seguro de Crear el usuario con los parámetros Enviados?" icon="ui-icon-alert" />
                </p:commandButton>    
                <p:confirmDialog global="true" showEffect="fade" hideEffect="explode">  
                    <p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"/>  
                    <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/>       
                </p:confirmDialog>
            </h:panelGrid>                                   
        </h:form> 
    </h:body>
</html>
